package com.zfzs.post.controller;

import com.zfzs.post.aop.log.Log;
import com.zfzs.post.common.bean.ResponseResult;
import com.zfzs.post.model.dto.TerminalTypeIdDTO;
import com.zfzs.post.modules.post.service.dto.QueryTerminalListDTO;
import com.zfzs.post.model.vo.TerminalList4DistribuVo;
import com.zfzs.post.service.TerminalService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author wq
 * @date 2019/10/14 14:09
 * @description
 */
@RestController
@RequestMapping("terminal/")
@Slf4j
public class TerminalController {

    @Autowired
    private TerminalService terminalService;

    /**
     * 分配管理 查询设备
     *
     * @param queryTerminalListDTO
     * @return
     */
    @PostMapping("get_terminal_list")
    @Log("分配管理 查询设备")
    public ResponseResult getTerminalList4Distribu(@RequestBody QueryTerminalListDTO queryTerminalListDTO) {
        TerminalList4DistribuVo vo = terminalService.getTerminalList4Distribu(queryTerminalListDTO);
        return ResponseResult.ok(vo);
    }

    /**
     * 查询渠道下面的机具类型
     *
     * @return
     */
    @PostMapping("get_terminal_type_list")
    @Log("查询设备类型")
    public ResponseResult getTerminalTypeList() {
        Map<String, Object> map = terminalService.getTerminalTypeList();
        return ResponseResult.ok(map);
    }

    /**
     * 查询渠道下面的机具类型
     *
     * @return
     */
    @PostMapping("get_terminal_status_list")
    @Log("查询设备状态")
    public ResponseResult getTerminalStatusList() {
        Map<String, Object> map = terminalService.getTerminalStatusList();
        return ResponseResult.ok(map);
    }

    /**
     * 根据终端类型查询
     */
    @Log("根据终端类型查询")
    @PostMapping("get_terminal_type_info")
    public ResponseResult getTerminalTypeInfo(@Validated @RequestBody TerminalTypeIdDTO dto) {
        Map<String, Object> map = terminalService.getTerminalTypeInfo(dto);
        return ResponseResult.ok(map);
    }

    /**
     * 政策机具类型
     */
    @Log("政策机具类型")
    @PostMapping("get_policy_terminal_type_list")
    public ResponseResult getPolicyTerminalTypeList() {
        Map<String, Object> map = terminalService.getpolicyTerminalTypeList();
        return ResponseResult.ok(map);
    }

    /**
     * 库存状态
     */
    @Log("库存状态")
    @PostMapping("get_stock_state_list")
    public ResponseResult queryStockStateList() {
        Map<String, Object> map = terminalService.queryStockStateList();
        return ResponseResult.ok(map);
    }
}
